package com.example.practice3;

import com.example.practice3.domain.Student;
import com.example.practice3.repository.StudentRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Practice3Application {

    public static void main(String[] args) {

        SpringApplication.run(Practice3Application.class, args);
    }

    @Bean
    public CommandLineRunner dataLoader(StudentRepository repo) {
        return new CommandLineRunner() {

            @Override
            public void run(String... args) throws Exception {
                repo.save(new Student());


            }
        };
    }
}
